import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [vue()],
	resolve: {
		extensions: [".js", ".vue", ".json", "scss", ".ts"],
		alias: [
			{
				find: "@",
				replacement: resolve(__dirname, "src"),
			},
			{
				find: "components",
				replacement: resolve(__dirname, "src/components"),
			},
			{
				find: "utils",
				replacement: resolve(__dirname, "src/utils"),
			},
			{
				find: "vites",
				replacement: resolve(__dirname, "src/view"),
			},
		],
	},
	server: {
		hmr: true,
		httpOnly: false,
		proxy: {
			'/url': {
				target: 'http://api.zadaraa.com',
				httpOnly: false,
				changeOrigin: true,
				pathRewrite: (path) => path.replace(/^\/url/, '')
			}
		}
	}
})
